import Vue from 'vue'
import Router from 'vue-router'

/* Layout */
import Layout from '../views/layout/Layout'
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)


/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
 *                                if not set alwaysShow, only more than one route under the children
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
 **/


export const constantRouterMap = [
  {path: '/login', component: () => import('../views/login/index'), hidden: true},
  {path: '/404', component: () => import('@/views/404'), hidden: true},

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },
  {
    path:'/agency',
    component:Layout,
    redirect:'/dashboard',
    name:'agency',
    meta:{title:'代理管理',icon:'setting',prem: 'agency_group'},
    children:[
      {
        path: 'mch',
        name: 'mch',
        component: () => import('@/views/merChant/index'),
        meta: {title: '商户管理', icon: 'setting',prem: 'mch'}
      },
      {
        path: 'GeneralAgent',
        name: 'GeneralAgent',
        component: () => import('@/views/AgentMain/index'),
        meta: {title: '总代账号管理', icon: 'setting',prem: 'agency'}
      },
      {
        path: 'Subagent',
        name: 'Subagent',
        component: () => import('@/views/AgentMag/index'),
        meta: {title: '子代账号管理', icon: 'setting',prem: 'agency'}
      },

      {
        path: 'Receipt',
        name: 'Receipt',
        component: () => import('@/views/Receipt/index'),
        meta: {title: '收款账号管理', icon: 'setting',prem: 'receipt_addresses'}
      }, {
        path: 'agencyRecharge',
        name: 'agencyRecharge',
        component: () => import('@/views/agencyRecharge/index'),
        meta: {title: '总代充值管理', icon: 'setting',prem: 'agency_admin_recharge'}
      }, {
        path: 'agencyChildRecharge',
        name: 'agencyChildRecharge',
        component: () => import('@/views/agencyChildRecharge/index'),
        meta: {title: '子代充值管理', icon: 'setting',prem: 'agency_recharge'}
      }
    ]
  },
  {
    path: '/order',
    component: Layout,
    redirect: '/dashboard',
    name: 'order',
    meta: {title: '订单管理', icon: 'setting', prem: 'order'},
    children:[
      {
        path: 'playerOrder',
        name: 'playerOrder',
        component: () => import('@/views/PlayerOrder/index'),
        meta: {title: '汇总订单管理', icon: 'setting',prem: 'order_get'}
      }, {
        path: 'mchOrder',
        name: 'mchOrder',
        component: () => import('@/views/MchOrder/index'),
        meta: {title: '商户订单管理', icon: 'setting',prem: 'inner_mch_order_get'}
      }
    ]
  },
  {
    path: '/data',
    component: Layout,
    redirect: '/dashboard',
    name: 'data',
    meta: {title: '运营管理', icon: 'setting',prem: 'recharge_group'},
    children:[
      {
        path: 'featureConf',
        name: 'featureConf',
        component: () => import('@/views/featureConf/index'),
        meta: {title: '功能配置', icon: 'setting', prem: 'features_config'}
      },
      {
        path: 'Bulletin',
        name: 'Bulletin',
        component: () => import('@/views/Bulletion/index'),
        meta: {title: '公告配置', icon: 'setting', prem: 'bulletin'}
      },
      {
        path: 'chatrecord',
        name: 'chatrecord',
        component: () => import('@/views/ChatRecord/index'),
        meta: {title: '聊天管理', icon: 'setting', prem: 'agency_chat'}
      },
      {
        path: 'blacklist',
        name: 'blacklist',
        component: () => import('@/views/BlackList/index'),
        meta: { title: '黑名单管理', icon: 'setting', prem: 'blacklist' }
      },
      {
        path: 'evaluation',
        name: 'evaluation',
        component: () => import('@/views/Evaluation/index'),
        meta: {title: '评价管理', icon: 'setting', prem: 'comment'}
      },
      {
        path: 'complaint',
        name: 'complaint',
        component: () => import('@/views/Complaint/index'),
        meta: {title: '投诉管理', icon: 'setting', prem: 'complain_get'}
      }
    ]
  },
  {
    path: '/reports',
    component: Layout,
    redirect: '/reports/report',
    name: 'reports',
    meta: {title: '报表管理', icon: 'setting', prem: 'report'},
    children: [
      {
        path: 'report',
        name: 'report',
        component: () => import('@/views/report/index'),
        meta: {title: '报表管理', icon: 'setting', prem: 'agency_report_get'}
      },
      {
        path: 'mchReport',
        name: 'mchReport',
        component: () => import('@/views/mchReport/index'),
        meta: {title: '商户报表管理', icon: 'setting', prem: 'inner_agency_report_get'}
      },
    ]
  },
  // {
  //   path: '/config',
  //   component: Layout,
  //   redirect: '/dashboard',
  //   name: 'config',
  //   meta: {title: '配置相关', icon: 'setting', prem: 'config_group'},
  //   children:[
  //     // {ß
  //     //   path: 'ReceiptConf',
  //     //   name: 'ReceiptConf',
  //     //   component: () => import('@/views/ReceiptConf/index'),
  //     //   meta: {title: '收款公共文案', icon: 'setting',}
  //     // },
  //   ]
  // },
  {
    path: '/auth',
    component: Layout,
    redirect: '/dashboard',
    name: 'auth',
    meta: {title: '权限管理', icon: 'setting', prem: 'admin_group'},
    children:[
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/userMag/index'),
        meta: {title: '用户管理', icon: 'setting', prem: 'admin_user_group'}
      }, {
        path: 'role',
        name: 'role',
        component: () => import('@/views/roleMag/index'),
        meta: {title: '角色管理', icon: 'setting', prem: 'admin_role_group'}
      },  {
        path: 'operatLog',
        name: 'operatLog',
        component: () => import('@/views/operatLog/index'),
        meta: {title: '操作记录', icon: 'setting', prem: 'record'}
      }
    ]
  },



  // ,
  // {
  //   path: '/data',
  //   component: Layout,
  //   redirect: '/data/dailyData',
  //   name: 'data',
  //   meta: {title: '运营相关', icon: 'setting'},
  //   children: [
  //     {
  //       path: 'mch',
  //       name: 'mch',
  //       component: () => import('@/views/merChant/index'),
  //       meta: {title: '商户管理', icon: 'setting',}
  //     }, {
  //       path: 'ReceiptConf',
  //       name: 'ReceiptConf',
  //       component: () => import('@/views/ReceiptConf/index'),
  //       meta: {title: '收款公共回复文案', icon: 'setting',}
  //     }, {
  //       path: 'Receipt',
  //       name: 'Receipt',
  //       component: () => import('@/views/Receipt/index'),
  //       meta: {title: '收款账号管理', icon: 'setting',}
  //     }, {
  //       path: 'AgentMain',
  //       name: 'AgentMain',
  //       component: () => import('@/views/AgentMain/index'),
  //       meta: {title: '总代管理', icon: 'setting',}
  //     }, {
  //       path: 'AgentMag',
  //       name: 'AgentMag',
  //       component: () => import('@/views/AgentMag/index'),
  //       meta: {title: '代理管理', icon: 'setting',}
  //     }, {
  //       path: 'featureConf',
  //       name: 'featureConf',
  //       component: () => import('@/views/featureConf/index'),
  //       meta: {title: '功能配置', icon: 'setting',}
  //     }, {
  //       path: 'Bulletin',
  //       name: 'Bulletin',
  //       component: () => import('@/views/Bulletion/index'),
  //       meta: {title: '公告管理', icon: 'setting',}
  //     }, {
  //       path: 'agencyRecharge',
  //       name: 'agencyRecharge',
  //       component: () => import('@/views/agencyRecharge/index'),
  //       meta: {title: '总代充值', icon: 'setting',}
  //     }, {
  //       path: 'agencyChildRecharge',
  //       name: 'agencyChildRecharge',
  //       component: () => import('@/views/agencyChildRecharge/index'),
  //       meta: {title: '子代充值', icon: 'setting',}
  //     },
  //     {
  //       path: 'blacklist',
  //       name: 'blacklist',
  //       component: () => import('@/views/BlackList/index'),
  //       meta: { title: '黑名单', icon: 'setting', }
  //     },
  //     {
  //       path: 'playerOrder',
  //       name: 'playerOrder',
  //       component: () => import('@/views/PlayerOrder/index'),
  //       meta: {title: '玩家订单', icon: 'setting',}
  //     } ,{
  //       path: 'report',
  //       name: 'report',
  //       component: () => import('@/views/report/index'),
  //       meta: {title: '查看代理报表', icon: 'setting',}
  //     }
  //   ]
  // }, {
  //   path: '/auth',
  //   component: Layout,
  //   redirect: '/auth/user',
  //   name: 'auth',
  //   meta: {title: '权限管理', icon: 'setting', prem: 'admin_group'},
  //   children: [
  //     {
  //       path: 'user',
  //       name: 'user',
  //       component: () => import('@/views/userMag/index'),
  //       meta: {title: '用户管理', icon: 'setting', prem: 'admin_user_group'}
  //     }, {
  //       path: 'role',
  //       name: 'role',
  //       component: () => import('@/views/roleMag/index'),
  //       meta: {title: '角色管理', icon: 'setting', prem: 'admin_role_group'}
  //     },  {
  //       path: 'operatLog',
  //       name: 'operatLog',
  //       component: () => import('@/views/operatLog/index'),
  //       meta: {title: '操作记录', icon: 'setting', prem: 'operatLog _user_group'}
  //     }
  //   ]
  // }, {
  //   path: '/chat',
  //   component: Layout,
  //   redirect: '/orders/Chat',
  //   name: 'chat',
  //   meta: {title: '聊天后台相关', icon: 'setting', prem: 'admin_group'},
  //   children: [
  //     {
  //       path: 'evaluation',
  //       name: 'evaluation',
  //       component: () => import('@/views/Evaluation/index'),
  //       meta: {title: '评价', icon: 'setting', prem: 'admin_evaluation_group'}
  //     },
  //     {
  //       path: 'complaint',
  //       name: 'complaint',
  //       component: () => import('@/views/Complaint/index'),
  //       meta: {title: '投诉', icon: 'setting', prem: 'admin_complaint_group'}
  //     },{
  //       path: 'chatrecord',
  //       name: 'chatrecord',
  //       component: () => import('@/views/ChatRecord/index'),
  //       meta: {title: '客服聊天查询', icon: 'setting', prem: 'admin_chatrecord_group'}
  //     }
  //   ]
  // },

  {path: '*', redirect: '/404', hidden: true}
]

export default new Router({
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})

